<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Upload iframe</title>
</head>
<body>
	<form name="fileform" id="fileform" action="/file/" method="post" enctype="multipart/form-data">
		<input name="file" id="file" type="file" />
		<input name="doSubmit" id="doSubmit" type="submit" value="Send File" disabled="disabled"/>
	</form>
	
	<script src="script/jquery/jquery-1.5.1.min.js"></script>
	<script src="script/jquery/jquery-ui-1.8.5.custom.min.js"></script>
	<script src="script/common.js"></script>
	
	<script>
		$(document).ready(function() {
			$.getJSON(common.createPath({op : "gi"}), function(data) {
				document.fileform.action += data.id + "/dummy-op/dummy-filename";
				document.fileform.doSubmit.disabled = false;
				
				$('#fileform').submit(function(event) {
					event.preventDefault();
					if(document.fileform.file.value) {				
						parent.logic.handleSubmit(document.fileform, data.id);
					} else {
						alert("You must select a file!");
					}
					return false;
				});
			});
			
		});
	</script>
</body>
</html>